<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:30:"./themes/admin/dp\article.html";i:1743055607;s:39:"D:\phpcode\syzth\themes\admin\base.html";i:1741049647;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title><?php echo $setup['title']; ?></title>
    <meta content="<?php echo $setup['keywords']; ?>" name="keywords" />
    <meta content="<?php echo $setup['description']; ?>" name="description" />
    <?php if($setup['ico'] != null): ?><link rel="shortcut icon" type="image/x-icon"  href="/public/uploads/<?php echo $setup['ico']; ?>"/><?php endif; ?>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/public/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/public/layuiadmin/style/admin.css" media="all">
    <!--CSS引用-->
    
    <!--页面CSS-->
    <!--[if lt IE 9]>
    <script src="/public/static/js/html5shiv.min.js"></script>
    <script src="/public/static/js/respond.min.js"></script>
    <![endif]-->
</head>
<body>

<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-tab layui-tab-brief">
            <ul class="layui-tab-title">
                <li class="<?php if($category == 0): ?>layui-this<?php endif; ?>">
                    <a href="<?php echo url('admin/dp/article', ['category' => 0]); ?>">工作动态</a>
                </li>
                <li class="<?php if($category == 1): ?>layui-this<?php endif; ?>">
                    <a href="<?php echo url('admin/dp/article', ['category' => 1]); ?>">政策列表</a>
                </li>
                <li><a href="<?php echo url('admin/dp/article_add', ['category' => $category]); ?>">添加文章</a></li>
            </ul>

            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <table class="layui-table" lay-size="sm">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>标题</th>
                            <th>分类</th>
                            <th>创建时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php if(is_array($articles) || $articles instanceof \think\Collection || $articles instanceof \think\Paginator): if( count($articles)==0 ) : echo "" ;else: foreach($articles as $key=>$vo): ?>
                        <tr>
                            <td><?php echo $vo['id']; ?></td>
                            <td><?php echo $vo['title']; ?></td>
                            <td>
                                <?php if($vo['category'] == 0): ?>
                                    <span class="layui-badge layui-bg-blue">工作动态</span>
                                <?php elseif($vo['category'] == 1): ?>
                                    <span class="layui-badge layui-bg-orange">政策列表</span>
                                <?php endif; ?>
                            </td>
                            <td><?php echo date('Y-m-d H:i:s', $vo['create_time']); ?></td>
                            <td>
                                <a href="<?php echo url('admin/dp/article_edit',['id'=>$vo['id']]); ?>" class="layui-btn layui-btn-sm">编辑</a>
                                <a href="<?php echo url('admin/dp/article_delete',['id'=>$vo['id']]); ?>" class="layui-btn layui-btn-sm ajax-delete">删除</a>
                            </td>
                        </tr>
                        <?php endforeach; endif; else: echo "" ;endif; ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<!--页面-->

<!--JS引用-->
<script src="/public/static/js/jquery.min.js"></script>
<script src="/public/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '/public/layuiadmin/' //静态资源所在路径
    }).extend({
        index: "lib/index" //主入口模块
    }).use('index');
</script>

<script>
layui.use(['layer'], function(){
    var $ = layui.jquery, layer = layui.layer;

    $('.ajax-delete').on('click', function () {
        var _href = $(this).attr('href');
        layer.confirm('确定删除该文章？', function(index){
            $.get(_href, function(info){
                if(info.code === 1){
                    location.reload();
                }
                layer.msg(info.msg);
            });
            layer.close(index);
        });
        return false;
    });
});
</script>

<!--页面JS脚本-->
</body>
</html>

